/**
 * 2016，thor.com，all rights reserved。
 * 
 * Project：		palmmall-core
 * Filename：	SMeterValueConverter.java
 * Created：		2016年8月30日
 * Creator：		wolv
 */
package com.thor.palmmall.rest.meter.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.meter.AMeterValue;
import com.thor.palmmall.spi.meter.SMeterValue;

/**
 * @author wolv
 *
 */
public class SMeterValueConverter implements Converter<AMeterValue, SMeterValue> {

	public static SMeterValueConverter getInstance() {
		if (instance == null)
			instance = new SMeterValueConverter();
		return instance;
	}

	private static SMeterValueConverter instance;

	private SMeterValueConverter() {
	}

	@Override
	public SMeterValue convert(AMeterValue source) {
		if (source == null)
			return null;

		SMeterValue target = new SMeterValue();
		target.setCycleCount(source.getCycleCount());
		target.setDate(source.getDate());
		target.setValue(source.getValue());

		return target;
	}

}
